﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LuceneWrap.Lib
{

    public class LuceneObjectStore
    {

        public static void Store<T>(T obj)
        {

            LuceneManager<T> luceneManager = new LuceneManager<T>(@"c:\temp\luceneWrapTestData\Index");

            luceneManager.AddObjectToIndex(obj);

            //luceneManager.AddItemToIndex(new WebSiteInfo { Name = "test", Domain = "test.com", Language = "telugu", LocalName = "some localname", ID = 213, LastCrawledTimeStampGMT = DateTime.UtcNow.AddDays(-10) });
            luceneManager.FinalizeWriter(true);
        }

        public static void Store<T>(List<T> listOfobj)
        {
            LuceneManager<T> luceneManager = new LuceneManager<T>(@"c:\temp\luceneWrapTestData\Index");

            luceneManager.AddItemsToIndex(listOfobj);

            //luceneManager.AddItemToIndex(new WebSiteInfo { Name = "test", Domain = "test.com", Language = "telugu", LocalName = "some localname", ID = 213, LastCrawledTimeStampGMT = DateTime.UtcNow.AddDays(-10) });
            luceneManager.FinalizeWriter(true);
        }

        public static List<T> Search<T>(string searchText)
        {
            return null;
        }

        public static List<object> OpenSearch(string searchText)
        {
            return null;
        }
    }
}
